<template>
  <!-- 图片裁剪 -->
  <tuiPictureCropper :imageUrl="imageUrl" @cropper="cropper" @ready="ready" :limitMove="false" :disableRotate="false"></tuiPictureCropper>
</template>

<script setup lang="ts">
import tuiPictureCropper from "@/components/tui-picture-cropper/tui-picture-cropper.vue";
import useCounterStore from "@/stores/counter";
const counter = useCounterStore();
const { proxy } = getCurrentInstance();
let imageUrl = ref("");
let src = ref("");

onLoad((e) => {
  src.value = e.url;
});

function ready() {
  imageUrl.value = src.value;
}
function cropper(e) {
  let cropperUrl = e.url || e.base64;
  counter.setRelease("cropperUrl", cropperUrl);
  proxy.$utils.back(); //返回上一层
}
</script>



<style lang="scss" scoped>
</style>
